From 85a1255a661d097b33fbd064d035f02bbf99bea6 Mon Sep 17 00:00:00 2001 From: Julien Grall Date: Mon, 16 Jul 2018 18:27:04 +0100 Subject: [PATCH] xen/arm: Rework lpae_table Currently, lpae_table can only work on entry from any level other than 3. Make it work with any level by extending the prototype to pass the level. At the same time, rename the function to lpae_is_mapping so naming stay consistent accross all lpae_* helpers. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- xen/arch/arm/mm.c | 2 +- xen/include/asm-arm/lpae.h | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index d234c46e41..b7f2dabd05 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -996,7 +996,7 @@ static int create_xen_entries(enum xenmap_operation op, for(; addr < addr_end; addr += PAGE_SIZE, mfn = mfn_add(mfn, 1)) { entry = &xen_second[second_linear_offset(addr)]; - if ( !lpae_table(*entry) ) + if ( !lpae_is_table(*entry, 2) ) { rc = create_xen_table(entry); if ( rc < 0 ) { diff --git a/xen/include/asm-arm/lpae.h b/xen/include/asm-arm/lpae.h index 4cf188ff82..c803569c2d 100644 --- a/xen/include/asm-arm/lpae.h +++ b/xen/include/asm-arm/lpae.h @@ -133,14 +133,9 @@ static inline bool lpae_valid(lpae_t pte) return pte.walk.valid; } -/* - * This one can only be used on L0..L2 ptes because L3 mappings set - * the table bit and therefore these would return the opposite to what - * you would expect. - */ -static inline bool lpae_table(lpae_t pte) +static inline bool lpae_is_table(lpae_t pte, unsigned int level) { - return lpae_valid(pte) && pte.walk.table; + return (level < 3) && lpae_valid(pte) && pte.walk.table; } static inline bool lpae_is_mapping(lpae_t pte, unsigned int level) -- 2.30.2